from decimal import Decimal
from datetime import datetime
from pydantic import BaseModel, ConfigDict, Field
from pydantic.alias_generators import to_camel
from typing import Optional
from module_admin.annotation.pydantic_annotation import as_query




class UnitinfoModel(BaseModel):
    """
    填报单位信息表对应pydantic模型
    """
    model_config = ConfigDict(alias_generator=to_camel, from_attributes=True)

    id: Optional[int] = Field(default=None, description='主键')
    guid: Optional[str] = Field(default=None, description='UUID')
    compname: Optional[str] = Field(default=None, description='单位名称')
    compid: Optional[int] = Field(default=None, description='单位ID')
    year: Optional[str] = Field(default=None, description='年度')
    yearupfile_guid: Optional[str] = Field(default=None, description='上年上传状态')
    yearnowfile_guid: Optional[str] = Field(default=None, description='本年上传状态')
    leader: Optional[str] = Field(default=None, description='科室')
    dept_id: Optional[int] = Field(default=None, description='部门ID')
    progress: Optional[Decimal] = Field(default=None, description='进度')
    status: Optional[str] = Field(default=None, description='审核状态')
    department: Optional[str] = Field(default=None, description='所属区县')
    remark: Optional[str] = Field(default=None, description='备注')
    sort: Optional[int] = Field(default=None, description='排序')
    create_time: Optional[datetime] = Field(default=None, description='创建时间')
    update_time: Optional[datetime] = Field(default=None, description='更新时间')
    pjxms: Optional[str] = Field(default=None, description='绩效项目个数')
    sjjz: Optional[str] = Field(default=None, description='绩效所用资金')
    main_type: Optional[int] = Field(default=None, description='单位类型: 0: 机关单位, 1: 事业单位')
    nine_table: Optional[int] = Field(default=None, description='九张表导入状态: 0: 未导入, 1:已导入')
    zpbg: Optional[int] = Field(default=None, description='自评报告是否上传，0：为上传，1：已上传')
    download_time: Optional[datetime] = Field(default=None, description='最后一次下载报告时间')






class UnitinfoQueryModel(UnitinfoModel):
    """
    填报单位信息不分页查询模型
    """
    pass


@as_query
class UnitinfoPageQueryModel(UnitinfoQueryModel):
    """
    填报单位信息分页查询模型
    """

    page_num: int = Field(default=1, description='当前页码')
    page_size: int = Field(default=10, description='每页记录数')


class DeleteUnitinfoModel(BaseModel):
    """
    删除填报单位信息模型
    """

    model_config = ConfigDict(alias_generator=to_camel)

    ids: str = Field(description='需要删除的主键')
